/** 
  其他境外交流项目管理-指定专家
*/
<template>
  <div class="specify-experts-container">
    <div class="float-left" style="margin-bottom: 20px;">
      <el-input
        v-model="specifyForm.condition.teacherCodeOrName"
        :placeholder="$t('exchangeProjectAudit.placeholderNumberIdOrName')"
        style="width:250px"
        @keyup.enter.native="filterExperts">
          <i slot="suffix"
            class="el-icon-search"
            style="margin-top:10px;cursor:pointer"
            @click="filterExperts">
          </i>
      </el-input>
    </div>
    <self-edu-table 
      ref="expertsInfoChoose" 
      :selection="false" 
      :pagination="false" 
      :order='true' 
      :attrAudio="true" 
      :tooltipEffect="tooltipEffect" 
      stripe 
      :data="expertsList" 
      size="mini" 
      @change-current-radio="chooseTeacher">
        <edu-table-column :label="$t('exchangeProjectAudit.teacherCode')" prop="teacherCode"></edu-table-column>
        <edu-table-column :label="$t('exchangeProjectAudit.teacherName')" prop="teacherName"></edu-table-column>
        <edu-table-column :label="$t('exchangeProjectAudit.titleName')" prop="titleName"></edu-table-column>
        <edu-table-column :label="$t('exchangeProjectAudit.facultyName')" prop="facultyName"></edu-table-column>
    </self-edu-table>
    <el-row type="flex" class="row-bg" justify="end">
      <el-col>
        <el-pagination
          @size-change="handleExpertsSizeChange"
          @current-change="handleExpertsCurrentChange"
          :current-page="specifyForm.pageNum_"
          :page-sizes="[20, 40, 80, 100]"
          :page-size="specifyForm.pageSize_"
          layout="total, sizes, prev, pager, next, jumper"
          :total="specifyForm.total_"
          style="float:right;margin-top:10px"
        ></el-pagination>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import externalExchangeApi from 'common/src/api/externalExchange/externalExchange';
import selfEduTable from 'common/src/views/graduateStudent/common/selfEduTable';
export default {
  name: 'expertsInfo',
  components: {
    'self-edu-table': selfEduTable
  },
  data() {
    return {
      specifyForm: {
        "pageNum_": 1,
        "pageSize_": 20,
        "condition":{
          "teacherCodeOrName": ""
        },
        "total_": 0
      },
      expertsList: []
    }
  },
  props: {
    
  },
  created() {
    this.initData()
  },
  mounted: {

  },
  methods: {
    clearData() {
      this.specifyForm.condition.teacherCodeOrName = ''
      this.specifyForm.pageNum_ = 1
    },
    initData() {
      this.getExpertsData()
    },
    handleExpertsSizeChange(val) {
      this.specifyForm.pageSize_ = val
      this.getExpertsData()
    },
    handleExpertsCurrentChange(val) {
      this.specifyForm.pageNum_ = val
      this.getExpertsData()
    },
    // 搜索专家
    filterExperts() {
      this.specifyForm.pageNum_ = 1
      this.getExpertsData()
    },
    // 查询专家
    getExpertsData() {
      let queryForm = JSON.parse(JSON.stringify(this.specifyForm))
      queryForm.condition.teacherCodeOrName = queryForm.condition.teacherCodeOrName.trim()
      externalExchangeApi.getDesignedExpertsList(queryForm).then((res) => {
        if (res.code === 200) {
          this.expertsList = res.data.list
          this.specifyForm.total_ = res.data.total_
        }
      })
    },
    // 选择专家
    chooseTeacher(row) {
      this.$emit('change-current-experts', row)
    }
  }
}
</script>

<style>

</style>